import service from '@/base';
import JWTSecret from 'haibei-secret';
//图片地址
// let uploadFile = 'https://test01.haibeiclub.com:3301/upload';   //测试
 let uploadFile = 'https://api.haibeiclub.com:3301/upload';   //正式

//导出数据接口
// let baseURL = 'http://192.168.1.99:18081/agentfind_manager/'; //文件下载  测试
// let baseURL = 'http://broker.haibeiclub.com:3501/agentfind_manager/'; //文件下载  正式
let baseURL = 'http://120.76.102.182:8891/agentfind_manager/'; //文件下载  正式

export default {
  // 上传
  haiBeiServerUpload() {
    return uploadFile;
  },

  //用户管理
  //2.1登录
  haiBeiServerLogin(params){ //[1]
    params = JWTSecret.jwt(params);
    return service.post( 'login.action',{ encry:params } ).then( res => res.data );
  },
  //2.2   登出
  haiBeiServerLoginOut(params){ //[2]
    params = JWTSecret.jwt( params );
    return service.post( 'loginOut.action',{ encry:params } ).then( res => res.data );
  },
  //2.3   修改密码
  haiBeiServerEditPassword(params){ //[3]
    params = JWTSecret.jwt( params );
    return service.post( 'editPassword.action',{ encry:params } ).then( res => res.data );
  },

  //3.	经纪商管理
  //3.1   修改经纪商信息
  haiBeiServerUpdateAgentInfo(params){ //[4]
    params = JWTSecret.jwt( params );
    return service.post( 'updateAgentInfo.action',{ encry:params } ).then( res => res.data );
  },
  //3.2   查询经纪商信息
  haiBeiServerQueryAgentInfo(params){ //[5]
    params = JWTSecret.jwt( params );
    return service.post( 'queryAgentInfo.action',{ encry:params } ).then( res => res.data );
  },
  //3.3   查询经纪商编号对应的名称
  haiBeiServerQueryAgentList(params){ //[6]
    params = JWTSecret.jwt( params );
    return service.post( 'queryAgentList.action',{ encry:params } ).then( res => res.data );
  },

  //4.	推送管理
  //4.1   查询推送列表
  haiBeiServerQueryPushList(params){ //[7]
    params = JWTSecret.jwt( params );
    return service.post( 'queryPushList.action',{ encry:params } ).then( res => res.data );
  },
  //4.2   发布推送信息
  haiBeiServerAddPushMsg(params){ //[8]
    params = JWTSecret.jwt( params );
    return service.post( 'addPushMsg.action',{ encry:params } ).then( res => res.data );
  },
  //4.3   删除推送信息
  haiBeiServerDeletePushMsg(params){ //[9]
    params = JWTSecret.jwt( params );
    return service.post( 'deletePushMsg.action',{ encry:params } ).then( res => res.data );
  },

  //5.	商品管理
  //5.1   商品列表
  haiBeiServerQueryGoodsList(params){ //[10]
    params = JWTSecret.jwt( params );
    return service.post( 'queryGoodsList.action',{ encry:params } ).then( res => res.data );
  },
  //5.2   新增商品
  haiBeiServerAddGoods(params){ //[11]
    params = JWTSecret.jwt( params );
    return service.post( 'addGoods.action',{ encry:params } ).then( res => res.data );
  },
  //5.3   编辑商品
  haiBeiServerUpdateGoodsInfo(params){ //[12]
    params = JWTSecret.jwt( params );
    return service.post( 'updateGoodsInfo.action',{ encry:params } ).then( res => res.data );
  },
  //5.4   商品上架、下架
  haiBeiServerUpdateGoodsStatus(params){ //[13]
    params = JWTSecret.jwt( params );
    return service.post( 'updateGoodsStatus.action',{ encry:params } ).then( res => res.data );
  },

  //6.	积分消费审批
  //6.1   列表查询
  haiBeiServerQueryOrderList(params){ //[14]
    params = JWTSecret.jwt( params );
    return service.post( 'queryOrderList.action',{ encry:params } ).then( res => res.data );
  },
  //6.2   消费审核
  haiBeiServerAuditUserOrder(params){ //[15]
    params = JWTSecret.jwt( params );
    return service.post( 'auditUserOrder.action',{ encry:params } ).then( res => res.data );
  },

  //7.	广告位管理
  //7.1.	新增、编辑广告位
  haiBeiServerAddAdvert(params){ //[16]
    params = JWTSecret.jwt( params );
    return service.post( 'addAdvert.action',{ encry:params } ).then( res => res.data );
  },

  //8.直播管理
  //8.1.	直播列表查询
  haiBeiServerQueryBroadcastList(params){ //[17]
    params = JWTSecret.jwt( params );
    return service.post( 'queryBroadcastList.action',{ encry:params } ).then( res => res.data );
  },
  //8.2.	根据账号查询讲师信息
  haiBeiServerQueryDocentByAccount(params){ //[18]
    params = JWTSecret.jwt( params );
    return service.post( 'queryDocentByAccount.action',{ encry:params } ).then( res => res.data );
  },
  //8.3.	创建直播
  haiBeiServerAddBroadcast(params){ //[19]
    params = JWTSecret.jwt( params );
    return service.post( 'addBroadcast.action',{ encry:params } ).then( res => res.data );
  },
  //8.4.	修改直播状态
  haiBeiServerUpdateBroadcastStatus(params){ //[20]
    params = JWTSecret.jwt( params );
    return service.post( 'updateBroadcastStatus.action',{ encry:params } ).then( res => res.data );
  },

  //9.	打赏列表
  //9.1.	列表查询
  haiBeiServerQueryRewardRecordList(params){ //[21]
    params = JWTSecret.jwt( params );
    return service.post( 'queryRewardRecordList.action',{ encry:params } ).then( res => res.data );
  },

  //新增接口
  //  根据ID查询商品信息
  haiBeiServerQueryGoodsById(params){ //[22]
    params = JWTSecret.jwt( params );
    return service.post( 'queryGoodsById.action',{ encry:params } ).then( res => res.data );
  },
  // 	导出excel 打赏列表
  haiBeiServerExportRewardList(params){ //[23]
    params = JWTSecret.jwt( params );
    return service.post( 'exportRewardList.action',{ encry:params } ).then( res => res.data );
  },
  // 	文件下载
  haiBeiServerDownloadFile(params){ //[24]
    return baseURL+'downloadFile.action?file='+params.file+'&showName='+params.showName
  },
  // 	广告位查询列表
  haiBeiServerQueryAdvertList(params){ //[25]
    params = JWTSecret.jwt( params );
    return service.post( 'queryAdvertList.action',{ encry:params } ).then( res => res.data );
  },
}
